package logger

import (
	"github.com/ihaiker/tfwrapper/internal/config"
	"github.com/sirupsen/logrus"
)

func Logger(running config.Running, module ...string) *logrus.Entry {
	log := logrus.WithField("file", running.RelPath())
	if running.Stack != "" {
		log = log.WithField("stack", running.Stack)
	}
	if running.StackSourceDir != "" {
		log = log.WithField("source", running.StackSourceDir)
	}
	if len(module) > 0 {
		log = log.WithField("type", module[0])
	}
	return log
}
